{% extends "base.html" %}
{% block title %}{% endblock %}
{% block content %}
<br>

<form class="layui-form" action="" id="cross_srh" lay-filter="cross_srh">
    <div class="layui-inline" >
        <label class="layui-form-label">project_name：</label>
                <div class="layui-input-inline">
                        <input type="text" class="layui-input" name="project_name" id="project_name" placeholder="请输入">
                </div><div class="layui-input-inline">
                <button type="button" id="project_save" class="layui-btn">保存</button></div>
    </div>
</form>

<script>
    layui.use(['table','code'], function(){
          var table = layui.table
          ,form = layui.form;
          var $= layui.jquery;
          //点击添加页面
          $('#project_save').on('click',function(){

                if($('#project_name').val()!=""){
                    $.ajax({
                        //发出请求
                        type:"POST",
                        url:"/project/manage",
                        contentType: 'application/json; charset=utf-8',
                        dataType:"json",
                        data:JSON.stringify({"project_name":$('#project_name').val()}),
                        success: function(result){
                            if(result.id){
                                layer.msg("保存成功!");
                                table.reload(options);
                            }else{
                                layer.msg("项目名称已经存在!");
                            }
                        }
                    });
                }else{
                    layer.msg("项目名称不能为空!");
                }
                return false;
          });

    });
</script>



{% endblock %}